﻿namespace Infra.Validation
{
    /// <summary>
    /// Validation class for a specified object.
    /// </summary>
    /// <typeparam name="T">The object to validate.</typeparam>
    public class ValidationEngineFor<T> where T : class 
    {
        private IValidator<T> Validator { get; set; }

        /// <summary>
        /// Initializes a new instance of the <see cref="ValidationEngineFor&lt;T&gt;"/> class.
        /// </summary>
        /// <param name="validator">The validator.</param>
        public ValidationEngineFor(IValidator<T> validator)
        {
            this.Validator = validator;
        }

        /// <summary>
        /// Validates the specified object.
        /// </summary>
        /// <param name="objectToValidate">The object to validate.</param>
        /// <returns></returns>
        public ValidationResult Validate(T objectToValidate)
        {
            return this.Validator.Validate(objectToValidate);
        }
    }
}
